;layui.define(
	["table","form"],
	function(exports){
		tab=layui.table,
		form = layui.form;
		tab.render({
			elem:"#LAY-web-list",
			url:layui.setter.base+"admin/role/listJson",
			cols:[[
				{field:"roleName",title:"角色名"},
				{field:"describe",title:"描述"},
				{field:"updateDateTime",title:"更新时间"},
				{title:"操作",width:240,align:"center",fixed:"right",toolbar:"#table-content-list"}
			]],
			page:!0,
			limit:10,
			limits:[10,15,20,25,30],
			text: {none: '暂无相关数据'}
		}),
		tab.on(
			"tool(LAY-web-list)",
			function(row){
				if("update"===row.event){
					parent.layer.open({
						type:2,
						title:"角色编辑",
						content:layui.setter.base+"admin/role/updatePage?id="+row.data.id,
						maxmin:!0,
						area: ['80%', '90%'],
						btn:["确定", "取消"],
			            yes: function(index, layero) {
			                //点击确认触发 iframe 内容中的按钮提交
			                layero.find('iframe').contents().find("#layuiadmin-app-form-edit").click();
			            }
					});
					return;
				}
				///////////////////////////////////////////////////////////
				if("alloct"===row.event){
					parent.layer.open({
						type:2,
						title:"分配权限",
						content:layui.setter.base+"admin/role/alloctSourcePage?id="+row.data.id,
						maxmin:!0,
						area: ['80%', '90%'],
						btn:["确定", "取消"],
			            yes: function(index, layero) {
			                //点击确认触发 iframe 内容中的按钮提交
			                layero.find('iframe').contents().find("#layuiadmin-app-form-edit").click();
			            }
					});
					return;
				}
				///////////////////////////////////////////////////////////
				if("delete"===row.event){
					layer.confirm("确定删除吗？",function(e){
						//请求删除接口
						layui.admin.req({
							url:layui.setter.base+"admin/role/delete?id="+row.data.id+"&r="+Math.random(),
							data: null,
							done: function(res){
								if(res.code !== 0){
						    		layer.msg(res.msg, {icon: 2});
								}else{
						    		layer.msg(res.msg, {icon: 1});
						    		layui.table.reload('LAY-web-list'); //重载表格
						    		layer.close(e); //再执行关闭
								}
							}
						});
					});
					return;
				}
			}
		),
		exports("adminRole",{})
	}
);